﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using TyMES.Model.GetData;
using TyMES.Model;

namespace TyMES.ViewModel.GetData.ProductDataTemplatesVMs
{
    public partial class ProductDataTemplatesListVM : BasePagedListVM<ProductDataTemplates_View, ProductDataTemplatesSearcher>
    {
        
        protected override IEnumerable<IGridColumn<ProductDataTemplates_View>> InitGridHeader()
        {
            return new List<GridColumn<ProductDataTemplates_View>>{
                
                this.MakeGridHeader(x => x.ProductDataTemplates_addTime).SetTitle(@Localizer["Page.添加时间"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_addUserId).SetTitle(@Localizer["Page.添加人id"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_addUserName).SetTitle(@Localizer["Page.添加人名称"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_dataSource).SetTitle(@Localizer["Page.数据源"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_dataSourceCode).SetTitle(@Localizer["Page.数据源类型"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_dataStatus).SetTitle(@Localizer["Page.数据状态"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_editTime).SetTitle(@Localizer["Page.编辑时间"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_editUserId).SetTitle(@Localizer["Page.编辑人id"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_editUserName).SetTitle(@Localizer["Page.编辑人名称"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_enableStatus).SetTitle(@Localizer["Page.启用状态"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_equCode).SetTitle(@Localizer["Page.设备编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_equName).SetTitle(@Localizer["Page.设备名称"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_factoryCode).SetTitle(@Localizer["Page.工厂编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_operationCode).SetTitle(@Localizer["Page.工序编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_operationName).SetTitle(@Localizer["Page.工序名称"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramCode).SetTitle(@Localizer["Page.设备数采参数编号"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramCodeKey).SetTitle(@Localizer["Page.参数编码key"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramName).SetTitle(@Localizer["Page.设备数采参数名称"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramNameKey).SetTitle(@Localizer["Page.参数名称key"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramRange1).SetTitle(@Localizer["Page.上限值"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramRange2).SetTitle(@Localizer["Page.下限值"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramUnit).SetTitle(@Localizer["Page.参数单位"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_paramValueKey).SetTitle(@Localizer["Page.参数值的key"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_sort).SetTitle(@Localizer["Page.排序编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_standardValue).SetTitle(@Localizer["Page.标准值"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_stationCode).SetTitle(@Localizer["Page.工位编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_templateCode).SetTitle(@Localizer["Page.模板编码"].Value),
                this.MakeGridHeader(x => x.ProductDataTemplates_uniqueCode).SetTitle(@Localizer["Page.设备唯一编号"].Value),

                this.MakeGridHeaderAction(width: 200)
            };
        }

        
        public override IOrderedQueryable<ProductDataTemplates_View> GetSearchQuery()
        {
            var query = DC.Set<ProductDataTemplates>()
                
                .CheckContain(Searcher.AddTime, x=>x.AddTime)
                .CheckContain(Searcher.AddUserId, x=>x.AddUserId)
                .CheckContain(Searcher.AddUserName, x=>x.AddUserName)
                .CheckContain(Searcher.DataSource, x=>x.DataSource)
                .CheckContain(Searcher.DataSourceCode, x=>x.DataSourceCode)
                .CheckContain(Searcher.DataStatus, x=>x.DataStatus)
                .CheckContain(Searcher.EditTime, x=>x.EditTime)
                .CheckContain(Searcher.EditUserId, x=>x.EditUserId)
                .CheckContain(Searcher.EditUserName, x=>x.EditUserName)
                .CheckContain(Searcher.EnableStatus, x=>x.EnableStatus)
                .CheckContain(Searcher.EquCode, x=>x.EquCode)
                .CheckContain(Searcher.EquName, x=>x.EquName)
                .CheckContain(Searcher.FactoryCode, x=>x.FactoryCode)
                .CheckContain(Searcher.OperationCode, x=>x.OperationCode)
                .CheckContain(Searcher.OperationName, x=>x.OperationName)
                .CheckContain(Searcher.ParamCode, x=>x.ParamCode)
                .CheckContain(Searcher.ParamCodeKey, x=>x.ParamCodeKey)
                .CheckContain(Searcher.ParamName, x=>x.ParamName)
                .CheckContain(Searcher.ParamNameKey, x=>x.ParamNameKey)
                .CheckContain(Searcher.ParamRange1, x=>x.ParamRange1)
                .CheckContain(Searcher.ParamRange2, x=>x.ParamRange2)
                .CheckContain(Searcher.ParamUnit, x=>x.ParamUnit)
                .CheckContain(Searcher.ParamValueKey, x=>x.ParamValueKey)
                .CheckEqual(Searcher.Sort, x=>x.Sort)
                .CheckContain(Searcher.StandardValue, x=>x.StandardValue)
                .CheckContain(Searcher.StationCode, x=>x.StationCode)
                .CheckContain(Searcher.TemplateCode, x=>x.TemplateCode)
                .CheckContain(Searcher.UniqueCode, x=>x.UniqueCode)
                .Select(x => new ProductDataTemplates_View
                {
				    ID = x.ID,
                    
                    ProductDataTemplates_addTime = x.AddTime,
                    ProductDataTemplates_addUserId = x.AddUserId,
                    ProductDataTemplates_addUserName = x.AddUserName,
                    ProductDataTemplates_dataSource = x.DataSource,
                    ProductDataTemplates_dataSourceCode = x.DataSourceCode,
                    ProductDataTemplates_dataStatus = x.DataStatus,
                    ProductDataTemplates_editTime = x.EditTime,
                    ProductDataTemplates_editUserId = x.EditUserId,
                    ProductDataTemplates_editUserName = x.EditUserName,
                    ProductDataTemplates_enableStatus = x.EnableStatus,
                    ProductDataTemplates_equCode = x.EquCode,
                    ProductDataTemplates_equName = x.EquName,
                    ProductDataTemplates_factoryCode = x.FactoryCode,
                    ProductDataTemplates_operationCode = x.OperationCode,
                    ProductDataTemplates_operationName = x.OperationName,
                    ProductDataTemplates_paramCode = x.ParamCode,
                    ProductDataTemplates_paramCodeKey = x.ParamCodeKey,
                    ProductDataTemplates_paramName = x.ParamName,
                    ProductDataTemplates_paramNameKey = x.ParamNameKey,
                    ProductDataTemplates_paramRange1 = x.ParamRange1,
                    ProductDataTemplates_paramRange2 = x.ParamRange2,
                    ProductDataTemplates_paramUnit = x.ParamUnit,
                    ProductDataTemplates_paramValueKey = x.ParamValueKey,
                    ProductDataTemplates_sort = x.Sort,
                    ProductDataTemplates_standardValue = x.StandardValue,
                    ProductDataTemplates_stationCode = x.StationCode,
                    ProductDataTemplates_templateCode = x.TemplateCode,
                    ProductDataTemplates_uniqueCode = x.UniqueCode,
                })
                 .OrderBy(x => x.ID);
            return query;
        }

        
    }
    public class ProductDataTemplates_View: ProductDataTemplates
    {
        
        public string ProductDataTemplates_addTime { get; set; }
        public string ProductDataTemplates_addUserId { get; set; }
        public string ProductDataTemplates_addUserName { get; set; }
        public string ProductDataTemplates_dataSource { get; set; }
        public string ProductDataTemplates_dataSourceCode { get; set; }
        public string ProductDataTemplates_dataStatus { get; set; }
        public string ProductDataTemplates_editTime { get; set; }
        public string ProductDataTemplates_editUserId { get; set; }
        public string ProductDataTemplates_editUserName { get; set; }
        public string ProductDataTemplates_enableStatus { get; set; }
        public string ProductDataTemplates_equCode { get; set; }
        public string ProductDataTemplates_equName { get; set; }
        public string ProductDataTemplates_factoryCode { get; set; }
        public string ProductDataTemplates_operationCode { get; set; }
        public string ProductDataTemplates_operationName { get; set; }
        public string ProductDataTemplates_paramCode { get; set; }
        public string ProductDataTemplates_paramCodeKey { get; set; }
        public string ProductDataTemplates_paramName { get; set; }
        public string ProductDataTemplates_paramNameKey { get; set; }
        public string ProductDataTemplates_paramRange1 { get; set; }
        public string ProductDataTemplates_paramRange2 { get; set; }
        public string ProductDataTemplates_paramUnit { get; set; }
        public string ProductDataTemplates_paramValueKey { get; set; }
        public int? ProductDataTemplates_sort { get; set; }
        public string ProductDataTemplates_standardValue { get; set; }
        public string ProductDataTemplates_stationCode { get; set; }
        public string ProductDataTemplates_templateCode { get; set; }
        public string ProductDataTemplates_uniqueCode { get; set; }

    }

}